package org.alexisjago.footballmanager.DAO;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class PersistenceManager {
	static EntityManagerFactory entityManagerFactory = Persistence
	.createEntityManagerFactory("org.alexisjago.footballmanager.jpa");

    public static EntityManager entityManager = entityManagerFactory
	.createEntityManager();
    
    public static void startTransaction(){
        entityManager.getTransaction().begin();
    }
    
	public static void commitTransaction(){
		entityManager.getTransaction().commit();
	}
	
	public void destroy(){
		entityManager.close();
	}
}
